package cn.wolfcode.crm.service.impl;


import cn.wolfcode.crm.domain.SystemLog;
import cn.wolfcode.crm.mapper.SystemLogMapper;
import cn.wolfcode.crm.query.ObjectQuery;
import cn.wolfcode.crm.query.PageResult;
import cn.wolfcode.crm.service.ISystemLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;

@Service
public class SystemLogServiceImpl implements ISystemLogService {
    @Autowired
    private SystemLogMapper systemLogMapper;
    //日志保存操作
    public void save(SystemLog systemLog) {
       
        //然后保存日志对象
        systemLogMapper.insert(systemLog);
    }

    public PageResult<SystemLog> query(ObjectQuery qo) {
        int totalCount = systemLogMapper.queryForCount(qo);
        if (totalCount == 0) {
            return new PageResult<SystemLog>(totalCount, Collections.<SystemLog>emptyList());
        }


        return new PageResult<SystemLog>(totalCount,systemLogMapper.queryForList(qo));
    }



}
